﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameBase;


namespace GalaxyPresident
{
    public class LivalePlanet : Planet
    {
        private float _taxRate = 0.05f;

        public LivalePlanet(string name,string strImage, float diameter, float velocity, Orbit orbit)
            : base(name,strImage, diameter, velocity, orbit)
        {           
        }

        protected override void initAtmosphereAndLand()
        {
            base.initAtmosphereAndLand();

            landColor = Constant.starColors[Constant.random.Next(Constant.starColors.Length)];
           // landColor = Color.Lerp(landColor, Color.Lime, 0.5f);
            backColor = Color.Navy;
            atmospherColor = Constant.starColors[Constant.random.Next(Constant.starColors.Length)];
            atmospherColor = Color.Lerp(atmospherColor, Color.White, 0.5f);
        }

        protected override void initBlock()
        {
            for (int i = 0; i < blockCount; i++)
                Blocks.Add(new LivableBlock(this, i));
        }

        public void setTaxRate(float taxRate)
        {
            _taxRate = taxRate;
        }

        public override float getIncreaseMoneyAmount()
        {
            return totalEconomic * _taxRate;
        }

        int count = 0;
        public override void UpdateInfo(GameTime gameTime)
        {
            base.UpdateInfo(gameTime);

            count += gameTime.ElapsedGameTime.Milliseconds;
            if (count > 250)
            {
                count = 0;
                float economicAmount = 0;
                foreach (Block block in _blocks)
                    economicAmount += block.getEconomicIncreaseAmount();
                totalEconomic = economicAmount;
            }
        }
    }
}
